package com.imooc.utils;

import com.imooc.enums.codeEnum;

public class EnumUtil {
    public static <T extends codeEnum> T getByCode(Integer code, Class<T> enumClass){
        for (T each: enumClass.getEnumConstants()){
            if (code.equals(each.getCode())){
                return each;
            }
        }
        return null;
    }
}
